<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<button open-type="getUserInfo" lang="zh_CN" @getuserinfo="onAuthorization">获取用户信息</button>
		<view class="text-area">
			<!-- <text class="title">{{userInfo.openId}}</text> -->
		</view>
	</view>
</template>
<script type="text/javascript">
	//通过命名空间的方式映入
	import {
		createNamespacedHelpers
	} from 'vuex'
	//获取需要管理的方法
	const {
		mapState,
		mapActions,
		mapMutations
	} = createNamespacedHelpers('user')
	export default {
		props: {
			value: [Array, Object]
		},
		data() {
			return {

			}
		},
		/**
		 * 计算属性
		 * @type {Object}
		 */
		computed: {
			...mapState(['userInfo']),
		},
		/**
		 * 数据监听
		 * @type {Object}
		 */
		watch: {
			userInfo(newName, oldName) {
				uni.navigateBack()
			}
		},
		/**
		 * 页面加载执行
		 * @return {[type]} [description]
		 */
		mounted() {

		},
		/**
		 * 页面方法
		 * @type {Object}
		 */
		methods: {
			...mapActions(['onAuthorization']),
		}
	}
</script>
<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200upx;
		width: 200upx;
		margin-top: 200upx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50upx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36upx;
		color: #8f8f94;
	}
</style>
